package com.info.zhiduoduo.core.service;

import com.info.zhiduoduo.repository.entity.company.CompanyProject;
import com.info.zhiduoduo.repository.entity.crowdsource.CrowdsourceProject;
import com.info.zhiduoduo.repository.entity.crowdsource.CrowdsourceTradeRecord;
import com.info.zhiduoduo.repository.entity.entrustmentproject.EntrustmentProject;
import com.info.zhiduoduo.repository.entity.partner.PartnerBrokerage;
import com.info.zhiduoduo.repository.entity.taxer.TaxerInvoice;
import com.info.zhiduoduo.repository.entity.taxer.TaxerPayment;

import java.math.BigDecimal;

public interface CoreBrokerageService {

	/**
	 * 准备项目的合伙人列表
	 *
	 * @param compid      企业id
	 * @param userid       创客id, 如果是 项目,需要判断此创客是否已经开通了分佣功能. 智众包项目不传.
	 * @param projectId   项目id,  项目id 或者 智众包项目id, 或 开票id
	 * @param projectType 项目类型 {@link com.info.zhiduoduo.common.constants.project.ProjectType}
	 */
	void prepareProjectBrokerage(int compid, int userid, int projectId, int projectType);

	/**
	 * 普通项目完成,处理佣金记录
	 *
	 * @param project
	 * @param tradeid
	 * @param tradeno
	 */
	void handleZhiduoduoProjectPartnerBrokerage(CompanyProject project, int tradeid, String tradeno);

	/**
	 * 众包项目完成,处理佣金记录
	 *
	 * @param tradeRecord
	 * @param project
	 */
	void handleCrowdsourceProjectPartnerBrokerage(CrowdsourceTradeRecord tradeRecord, CrowdsourceProject project);

	/**
	 * 创客团 项目完成,处理佣金记录
	 */
	void handleMakerGrouponZhiduoduoProjectPartnerBrokerage(EntrustmentProject project);

	/**
	 * 创客团智众包项目完成,处理佣金记录
	 */
	void handleMakerGrouponCrowdsourceProjectPartnerBrokerage(EntrustmentProject project);

	/**
	 * 纯代理或 开票完成,处理佣金记录
	 *
	 * @param payment
	 * @param invoice
	 */
	void handleTaxerInvoicePartnerBrokerage(TaxerPayment payment, TaxerInvoice invoice);

	/**
	 * 记录合伙人佣金到账流水
	 *
	 * @param partnerBrokerage
	 * @param projectname
	 */
	void recordPartnerAccountFlowAndNotice(PartnerBrokerage partnerBrokerage, String projectname);

	/**
	 * 获取合伙人所有未提的佣金，包括普通智众包项目佣金，智众包成本佣金
	 *
	 * @param partnerid 合伙人id
	 * @return 未提的佣金
	 */
	BigDecimal sumSettledUnremitCrowdsourceBrokerage(int partnerid);
}
